<template>
  <div style="position: relative;">
    <header_y></header_y>
    <sidebar></sidebar>
    <div style="position: absolute;top: 120px;left: 300px">
      <p>组织名称：<input type="text" placeholder="请输入组织名称" style="height: 35px">&emsp;&emsp;
        <button class="bt">查询</button>
        <button class="bt">重置</button>
      </p>
      <p>
        <button class="bb">新增</button>
        <button class="aa">导出</button>
        <van-uploader :after-read="afterRead">
          <van-button icon="plus" type="primary" class="aa">导入</van-button>
        </van-uploader>
      </p>
      <table border="1" cellspacing="0">
        <tr>
          <td>组织名称</td>
          <td>组织编码</td>
          <td>组织类型</td>
          <td>组织排序</td>
          <td>操作</td>
        </tr>
        <tr>
          <td>
            <fl :data="data" @pid="get_fl"></fl>
          </td>
          <td></td>
          <td></td>
          <td></td>
          <td></td>
        </tr>
      </table>
    </div>
  </div>
</template>

<script>
import header_y from "@/components/p9/comm/header_y";
import sidebar from "@/components/p9/comm/sidebar";
import maxios from "@/http/axios";
import wx_classify from "@/components/p9/comm/wx_classify";

export default {
  name: "texture",
  components: {
    'header_y': header_y,
    'sidebar': sidebar,
    'fl':wx_classify
  },
  data() {
    return {
      data:[]
    }
  },
  methods:{
    afterRead(file){
      let fromdata = new FormData()
      fromdata.append('file',file.file)
      maxios({'url':'http://127.0.0.1:5000/texture/upload','method':'post','data':fromdata}).then(res=>{
        alert(res.code)
      })
    },
    get_wx(){
      maxios('texture/show','get').then(res=>{
        this.data = res.matter
      })
    },
    get_fl(pid){
      alert(pid)
    }
  },
  mounted() {
    this.get_wx()
  }
}
</script>

<style scoped>
.bt {
  border: none;
  background-color: #2f54eb;
  width: 100px;
  height: 40px;
  color: white;
  margin-left: 10px;
}

.aa {
  height: 40px;
  width: 100px;
  border: none;
  margin-left: 10px
}

.bb {
  height: 40px;
  width: 100px;
  color: white;
  border: none;
  background-color: #2f54eb
}
</style>